<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript">
//科室新增
$(function(){
	$("#ksqr").click(function(){
		var aa=$("#ksmc").val();
		var bm=$("#xzbumen").val();
		if(aa==''){ 
			$.messager.alert("温馨提示：","科室名称不能为空！");
		}else if(!(/^[\u2E80-\u9FFF]+$/).test(aa)){
			$("#ksmc").textbox("setValue",null);
		}else{
			var bmlb=0;
			if(aa==''){
			}else{
				if(bm=='门诊'){
					bmlb=1;
				}else{
					bmlb=2;
				}
				$.ajax({
					url:'addks',
					type:'post',
					data:{
						ksmc:aa,
						kslb:bmlb
					},
					success:function(d){
						if(parseInt(d)==1){
							$("#ksmc").textbox('setValue',null);
							$("#xzbumen").textbox('setValue',null);
							$("#kestable").datagrid("reload");
							$.messager.show({
								title:'提 示',
								msg:'科室新增成功！！！！！！！',
								height:200,
								timeout:1000,
								showType:'slide'
							 });
						}else if(parseInt(d)==3){
							$.messager.alert("温馨提示：","门诊部已有该科室,请重新输入信息！");
						}else if(parseInt(d)==4){
							$.messager.alert("温馨提示：","住院部已有该科室,请重新输入信息！");
						}
					}
				});
			}
		}
		
	});
	//医疗项目新增
	$("#xmqr").click(function(){
		var bb=$("#xmmc").val();
		var je=$("#ysje").val();
		if(bb==''){
			$.messager.alert("温馨提示：","项目名称不能为空！");
		}else if(je==''){
			$.messager.alert("温馨提示：","项目金额不能为空！");
		}else if(!(/^[\u2E80-\u9FFF]+$/).test(bb)){
			$("#xmmc").textbox("setValue",null);
		}else if(!(/^\d*\.{0,1}\d{0,1}$/).test(je)){
			$("#ysje").textbox("setValue",null);
		}else{
			$.ajax({
				url:'ymAdd',
				type:'post',
				data:{
					xmmc:bb,
					xmje:je
				},
				success:function(d){
					if(parseInt(d)==1){
						$("#xmtable").datagrid("reload");
						$("#xmmc").textbox('setValue',null);
						$("#ysje").textbox('setValue',null);
						$.messager.show({
							title:'提 示',
							msg:'医疗项目新增成功！！！！！！！',
							height:200,
							timeout:1000,
							showType:'slide'
						 });
					}else if(parseInt(d)==3){
						$.messager.alert("温馨提示：","已有该医疗项目,请重新输入信息！");
					}
				}
			});
		}
	});
	
	$("#kestable").datagrid({
		url:'findks',
		fitColumns:true,
		pagination:true,
	    pageNumber:1,
	    pageSize:3,
	    pageList:[3,6],
	    columns:[[
			{field:'departments_id',title:'编号',width:80,align:'center'},
			{field:'departments_name',title:'名称',width:80,align:'center'},
			{field:'departments_lb',title:'部门',width:80,align:'center',
				formatter:function(value){
					if(value==1){
						return"门诊"
					}else{
						return "住院"
					}
				}},
	    ]]
	});
	
	$("#xmtable").datagrid({
		url:'ylxm',
		fitColumns:true,
		pagination:true,
	    pageNumber:1,
	    pageSize:3,
	    pageList:[3,6],
	    columns:[[
			{field:'cure_id',title:'编号',width:80,align:'center'},
			{field:'cure_name',title:'名称',width:80,align:'center'},
			{field:'cure_je',title:'价格',width:80,align:'center'},
	    ]]
	});
	$("#tjxmtable").datagrid({
		url:'findexamin',
		fitColumns:true,
		pagination:true,
	    pageNumber:1,
	    pageSize:3,
	    pageList:[3,6],
	    columns:[[
			{field:'examine_item_id',title:'编号',width:310/4,align:'center'},
			{field:'examine_item_name',title:'名称',width:310/4,align:'center'},
			{field:'examine_item_price',title:'价格',width:310/4,align:'center'},
	    ]],
	});
	//医疗项目查询
	$('#yiliaoxiangmu').searchbox({
		searcher:function(value,name){
		    $('#xmtable').datagrid({
		    	url:'nameYiLiao?cure_name='+value,
				});
		    } 
	});
	//科室名称查询
	$('#findallks').searchbox({
		searcher:function(value,name){
			$('#kestable').datagrid({
				url:'findks?departments_name='+value,
			});
		   } 
	});
	
	//根据名字查询体检项目
	$('#tijianname').searchbox({
		searcher:function(value,name){
			 $("#tjxmtable").datagrid({
					url:'tiJianName?examine_item_name='+value
				});
		}
	});
	$("#tjxmqr").click(function(){
		var tjxmmc=$('#tjxmmc').val();
		var tjxmje=$('#tjxmje').val();
		if(tjxmmc==''){
			$.messager.alert("温馨提示：","体检项目名称不能为空！");
		}else if(tjxmje==''){
			$.messager.alert("温馨提示：","体检项目金额不能为空！");
		}else if(!(/^([a-zA-Z0-9\u4e00-\u9fa5\·]{1,10})$/).test(tjxmmc)){
			$("#tjxmmc").textbox("setValue",null);
		}else if(!(/^\d*\.{0,1}\d{0,1}$/).test(tjxmje)){
			$("#tjxmje").textbox("setValue",null);
		}else{
			$.ajax({
				url:'xzTjxmCx',
				type:'post',
				data:{
					examine_item_name:tjxmmc,
					tjxmje:tjxmje
				},
				success:function(d){
					if(parseInt(d)==1){
						$('#tjxmmc').textbox('setValue',null);
						$('#tjxmje').textbox('setValue',null);
						$("#tjxmtable").datagrid("reload");
						$.messager.show({
							title:'提 示',
							msg:'体检项目新增成功！！！！！！！',
							height:200,
							timeout:1000,
							showType:'slide'
						 });
					}else if(parseInt(d)==3){
						$.messager.alert("温馨提示：","已有该体检项目,请重新输入信息！");
					}else{
						$.messager.alert("温馨提示：","新增失败！");
					}
				}
			});
		}
	})
});	
</script>
	<div style="width:1130px;height:300px;border:1px solid #19AA8D;border-radius:5px;margin:10px;">
					<div style="border:none;width:300px;height:250px;float:left;">
						<fieldset class="bingliluru" style="width:260px;height:215px;margin-left:10px;margin-top:43px;border:1px solid #19AA8D;border-radius:5px;">
							<legend>新增科室信息</legend>
								<select class="easyui-combobox" id="xzbumen" panelHeight='auto'
									data-options="label:'选择部门：',labelAlign:'right',width:250,panelHeight:64,editable:false">
									<option value="门诊" selected="selected">门诊</option>
									<option value="住院">住院</option>
								</select>
								<div style="margin-top:10px;">  <!-- style="margin-top:20px;" -->
								<input  id="ksmc" class="easyui-textbox"  required="required"
									data-options="label:'科室名称：',width:250,labelAlign:'right'">
								</div>
								<div style="margin-top:10px;"> 
								<a class='easyui-linkbutton que' style="margin-left:120px;height:30px;margin-bottom:10px;"id="ksqr">确认</a>		
								</div>
						</fieldset>
					</div>
						
				<div style="border:none;width:820px;height:270px;float:left;margin-top:15px;">
						<div style="margin-bottom:8px;">
							<input id="findallks" class="easyui-searchbox" style="width:280px;height:30px;"
							data-options="label:'记录检索：',prompt:'请输入科室编号或科室名称',labelAlign:'right'">
						</div>
						<table id="kestable" style="height:220px;width:820px;" class="easyui-datagrid" data-options="fitColumns:true,singleSelect:true">
						</table>
				</div>
	</div>
	
	<div style="width:1130px;height:300px;border:1px solid #19AA8D;margin-top:15px;border-radius:5px;margin:10px;">
			<div style="border:none;width:300px;height:250px;float:left;margin-top:43px;">
				<fieldset class="bingliluru" style="width:260px;height:215px;margin-left:10px;border:1px solid #19AA8D;border-radius:5px;">
					<legend>新增医疗项目信息</legend>
						
						<div>
							<input  id="xmmc" class="easyui-textbox"  required="required"
							data-options="label:'项目名称：',width:250,labelAlign:'right'">
						</div>
						<div style="margin-top:10px;">
							<input  id="ysje" class="easyui-textbox"  required="required"
							data-options="label:'预设金额：',width:250,labelAlign:'right'">
						</div>
						<div style="margin-top:10px;"> 
						<a class='easyui-linkbutton que' style="margin-left:120px;height:30px;margin-bottom:10px;"id="xmqr">确认</a>		
						</div>
				</fieldset>
			</div>
			<div style="border:none;width:820px;height:240px;float:left;margin-top:15px;border-radius:5px;">
					
					<div style="margin-bottom:8px;">
						<input id="yiliaoxiangmu" class="easyui-searchbox" style="width:280px;height:30px;"
						data-options="label:'记录检索：',prompt:'请输入项目编号或名称',labelAlign:'right'">
					</div>
					
					<table id="xmtable" style="height:220px;width:820px;" class="easyui-datagrid" data-options="fitColumns:true,singleSelect:true">
					</table>
			</div>
	</div>
	
	
	<div style="width:1130px;height:300px;border:1px solid #19AA8D;margin-top:15px;border-radius:5px;margin:10px;">
			<div style="border:none;width:300px;height:250px;float:left;margin-top:43px;">
				<fieldset class="bingliluru" style="width:260px;height:215px;margin-left:10px;border:1px solid #19AA8D;border-radius:5px;">
					<legend>新增体检项目信息</legend>
						
						<div>
							<input  id="tjxmmc" class="easyui-textbox"  required="required"
							data-options="label:'项目名称：',width:250,labelAlign:'right'">
						</div>
						<div style="margin-top:10px;">
							<input  id="tjxmje" class="easyui-textbox"  required="required"
							data-options="label:'预设金额：',width:250,labelAlign:'right'">
						</div>
						<div style="margin-top:10px;"> 
						<a class='easyui-linkbutton que' style="margin-left:120px;height:30px;margin-bottom:10px;"id="tjxmqr">确认</a>		
						</div>
				</fieldset>
			</div>
			<div style="border:none;width:820px;height:240px;float:left;margin-top:15px;border-radius:5px;">
					
					<div style="margin-bottom:8px;">
						<input id="tijianname" class="easyui-searchbox" style="width:280px;height:30px;"
						data-options="label:'记录检索：',prompt:'请输入项目编号或名称',labelAlign:'right'">
					</div>
					
					<table id="tjxmtable" style="height:220px;width:820px;" class="easyui-datagrid" data-options="fitColumns:true,singleSelect:true">
					</table>
			</div>
	</div>
</body>
</html>